#ifndef FSXHELPER_H
#define FSXHELPER_H
#include <QString>
#include <QDateTime>
#include <QFile>
#include <QCoreApplication>
#include <QTextStream>
#include <stdlib.h>

namespace FsxSimConnect {

//! Helper utilities, mostly proper formatting.
/*! \author KWB */
class FSXHelper
{
public:
    //! Formatted radio frequency.
    /*! \param frequency
        \param unit with unit
        \param digits
        \return formatted radio frequency */
    static QString formattedRadioFrequency(double frequency, bool unit = false, int digits=2);
    //! Formatted ADF frequency.
    /*! \param frequency
        \param unit with unit
        \param digits
        \return formatted ADF frequency */
    static QString formattedAdfFrequency(double frequency, bool unit = false, int digits = 0);
    //! Transponder code to string.
    /*! \return transponder code */
    static QString transponderCode(double code);
    //! Formatted NAV frequency.
    /*! \param frequency
        \param unit with unit
        \param digits
        \return formatted ADF frequency */
    static QString formattedNavFrequency(double frequency, bool unit = false, int digits =2);
    //! Get formatted time
    /*! \param timestamp
        \param localTime local or UTC time */
    static QString formattedTime(qint64 timestamp, bool localTime = true);
    //! Get formatted time
    /*! \param timestamp */
    static QString formattedTime(const QDateTime &timestamp);
    //! Location of local SimConnect.cfg (if existing).
    /*! \sa FSXHelper::getLocalSimConnectCfgFilename()
        \param fileName and path
        \param ip IP address of FSX
        \param port Port of FSX
        \return success */
    static bool simConnectCfg(const QString &fileName, const QString &ip, const int port);
    //! Location of local SimConnect.cfg (if existing).
    /*! \return file name and path */
    static QString getLocalSimConnectCfgFilename();
};
} // namespace

#endif // FSXHELPER_H
